Skip to content

fix(ci): cargo fmt + split 4 .rs files under 1000 LOC#752

Merged
zackees merged 1 commit into
mainfrom
fix/ci-fmt-and-loc
Jun 22, 2026
Merged

fix(ci): cargo fmt + split 4 .rs files under 1000 LOC#752
zackees merged 1 commit into
mainfrom
fix/ci-fmt-and-loc

Conversation

@zackees

@zackees zackees commented Jun 22, 2026

Copy link
Copy Markdown
Member

Summary

Two pre-existing CI gates were red on main; both unrelated to product behavior, both mechanical to fix.

  1. Formatting failed on crates/fbuild-daemon/src/handlers/websockets.rs. Resolved by cargo fmt --all.
  2. LOC Gate flagged 4 files over 1000 lines. For each, the #[cfg(test)] mod tests { ... } block was lifted into a sibling <stem>/tests.rs submodule, with #[cfg(test)] mod tests; replacing it in the parent. Tests stay at the same module path — purely a textual move.
File Before After
crates/fbuild-daemon/src/device_manager.rs 1006 687
crates/fbuild-cli/src/daemon_client.rs 1049 952
crates/fbuild-serial/src/manager.rs 1480 972
crates/fbuild-build/src/source_scanner.rs 1478 910

Each new <stem>/ directory ships a README per the repo's readme_guard.py hook.

Test plan

  • soldr cargo check --workspace --all-targets — clean
  • soldr cargo fmt --all -- --check — clean
  • soldr cargo clippy --workspace --all-targets -- -D warnings — clean
  • Local LOC scan — no .rs in workspace > 1000 LOC

🤖 Generated with Claude Code

Two pre-existing CI gates were red on main:

1. **Formatting** failed on `crates/fbuild-daemon/src/handlers/websockets.rs`.
   Resolved by `cargo fmt --all`. The same fmt pass also reflowed the
   newly-extracted test files.

2. **LOC Gate** flagged 4 files over 1000 lines:
     crates/fbuild-daemon/src/device_manager.rs       (1006, +6)
     crates/fbuild-cli/src/daemon_client.rs           (1049, +49)
     crates/fbuild-serial/src/manager.rs              (1480, +480)
     crates/fbuild-build/src/source_scanner.rs        (1478, +478)

   For each, lift the `#[cfg(test)] mod tests { ... }` block out of the
   parent file into a sibling `<stem>/tests.rs` submodule and replace
   it with `#[cfg(test)] mod tests;`. Tests stay in the same module
   path (`crate::<parent>::tests::...`) so test discovery is
   unchanged; this is purely a textual move that keeps the parent
   files under the gate.

After:
     device_manager.rs   687
     daemon_client.rs    952
     manager.rs          972
     source_scanner.rs   910

All four are well under 1000 and have room for routine growth before
needing further per-domain submodule splits (per the
`foo.rs → foo/<sub>.rs` convention in CLAUDE.md).

Each new `<stem>/` directory ships a README per the repo's
`readme_guard.py` hook.

Verified locally (with SOLDR_NO_ZCCACHE=1 as a workaround for a wedged
local zccache daemon — unrelated):
- `soldr cargo check --workspace --all-targets` → clean
- `soldr cargo fmt --all -- --check` → clean
- `soldr cargo clippy --workspace --all-targets -- -D warnings` → clean

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@zackees zackees merged commit 5b055c2 into main Jun 22, 2026
85 of 90 checks passed
@zackees zackees deleted the fix/ci-fmt-and-loc branch June 22, 2026 11:19
@zackees zackees mentioned this pull request Jun 22, 2026
2 tasks
zackees added a commit that referenced this pull request Jun 22, 2026
Minor bump. Picks up:
- #747 native fbuild as raw wheel script (drops Python launcher; fixes
  Windows stdout-ordering bug on COM25     303A:1001    USB Serial Device (COM25)    ser=80:F1:B2:D1:DF:B1
          └─ Espressif Systems / ESP32-S3 USB-CDC

COM1      [Unknown]
          └─ (no USB identifier — Unknown endpoint)

COM3      [Unknown]
          └─ (no USB identifier — Unknown endpoint)

COM22     303A:1001    USB Serial Device (COM22)    ser=D8:3B:DA:41:64:C0
          └─ Espressif Systems / ESP32-S3 USB-CDC

COM4      [Unknown]
          └─ (no USB identifier — Unknown endpoint)

COM9      303A:1001    USB Serial Device (COM9)    ser=8C:BF:EA:CF:87:B4
          └─ Espressif Systems / ESP32-S3 USB-CDC

COM20     16C0:0483    USB Serial Device (COM20)    ser=15821020
          └─ Van Ooijen Technische Informatica / Teensyduino Serial

COM10     1FC9:0132    USB Serial Device (COM10)    ser=0B03400A
          └─ NXP Semiconductors / LPC-Link2 CMSIS-DAP

5 USB ports, 3 non-USB ports)
- #748 src-layout package-dir (static analyzers resolve fbuild.api)
- #750 daemon WS handler split into reader/writer/inbound
- #751 gitignore .extern-repos/
- #752 cargo fmt + extract test modules so 4 files fall under the
  1000-LOC gate

No public-API changes beyond what's already documented in the merged
PRs above.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@zackees, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 17 minutes and 6 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits.

🚦 How do rate limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 5179ab42-258d-441b-83e4-bfd344db94e2

📥 Commits

Reviewing files that changed from the base of the PR and between 8c9678b and bff9066.

📒 Files selected for processing (12)
  • crates/fbuild-build/src/source_scanner.rs
  • crates/fbuild-build/src/source_scanner/README.md
  • crates/fbuild-build/src/source_scanner/tests.rs
  • crates/fbuild-cli/src/daemon_client.rs
  • crates/fbuild-cli/src/daemon_client/tests.rs
  • crates/fbuild-daemon/src/device_manager.rs
  • crates/fbuild-daemon/src/device_manager/README.md
  • crates/fbuild-daemon/src/device_manager/tests.rs
  • crates/fbuild-daemon/src/handlers/websockets.rs
  • crates/fbuild-serial/src/manager.rs
  • crates/fbuild-serial/src/manager/README.md
  • crates/fbuild-serial/src/manager/tests.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ci-fmt-and-loc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Triage

Development

Successfully merging this pull request may close these issues.

1 participant